package helper.form.inputs;

public class RangeInput extends BasicInput {

	
	protected Double min;
	protected Double max;
	protected Double step;
	
	public RangeInput(String name,String label) {
		super(name,label);
		this.min=Double.NaN;
		this.max=Double.NaN;
		this.step=Double.NaN;
	}
	
	public RangeInput(String name,String label, String value) {
		super(name,label,value);
		this.min=Double.NaN;
		this.max=Double.NaN;
		this.step=Double.NaN;
		
	}
	
	public RangeInput(String name,String label, String value, String cssClass) {
		super(name,label,value,cssClass);
		this.min=Double.NaN;
		this.max=Double.NaN;
		this.step=Double.NaN;
	}
	
	public RangeInput(String name,String label, String value, String cssClass, String otherHtml) {
		super(name,label,value,cssClass,otherHtml);
		this.min=Double.NaN;
		this.max=Double.NaN;
		this.step=Double.NaN;
	}
	
	public RangeInput(String name,String label,Double min, Double max, Double step) {
		super(name,label);
		this.min=min;
		this.max=max;
		this.step=step;
	}
	
	public RangeInput(String name,String label, String value,Double min, Double max, Double step) {
		super(name,label,value);
		this.min=min;
		this.max=max;
		this.step=step;	
	}
	
	public RangeInput(String name,String label, String value, String cssClass,Double min, Double max, Double step) {
		super(name,label,value,cssClass);
		this.min=min;
		this.max=max;
		this.step=step;	
	}
	
	public RangeInput(String name,String label, String value, String cssClass, String otherHtml,Double min, Double max, Double step) {
		super(name,label,value,cssClass,otherHtml);
		this.min=min;
		this.max=max;
		this.step=step;	
	}
	
	
	
	
	
	public double getMin() {
		return min;
	}

	public void setMin(double min) {
		this.min = min;
	}

	public double getMax() {
		return max;
	}

	public void setMax(double max) {
		this.max = max;
	}

	public double getStep() {
		return step;
	}

	public void setStep(double step) {
		this.step = step;
	}

	public String render() {
		String output = this.renderLabel();
		output="<input type=\"date\" name=\""+this.name+"\"";
		
		if(!this.value.isEmpty()) {
			output+="value =\""+this.value+"\"";
		}
		if(!this.cssClass.isEmpty()) {
			output+="class =\""+this.cssClass+"\"";
		}
		if(!this.otherHtml.isEmpty()) {
			output+=this.otherHtml;
		}
		
		if(!this.min.isNaN()) {
			output+="min=\""+this.min.toString()+"\"";
		}
		
		if(!this.max.isNaN()) {
			output+="max=\""+this.max.toString()+"\"";
		}
		if(!this.step.isNaN()) {
			output+="step=\""+this.step.toString()+"\"";
		}
		
		
		output+=" />\n";
		
		return output;
	}

}
